unit spr_Contragents;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, shbl_SimpleDirectory, PropFilerEh, ActnList, PropStorageEh,
  FIBDatabase, pFIBDatabase, DB, XLSExportComp, FIBDataSet, pFIBDataSet,
  ComCtrls, ExtCtrls, DBCtrls, ToolWin, GridsEh, DBGridEh, Menus;

type
  TsprContragents = class(TshblSimpleDirectory)
    dsReestrID: TFIBIntegerField;
    dsReestrNAME: TFIBStringField;
    dsReestrSHORT_NAME: TFIBStringField;
    dsReestrADDRESS: TFIBStringField;
    dsReestrPHONE: TFIBStringField;
    PopupMenu1: TPopupMenu;
    aDTypes: TAction;
    N1: TMenuItem;
    dsReestrDIRECTOR: TFIBStringField;
    ToolButton1: TToolButton;
    ToolButton2: TToolButton;
    procedure aDTypesExecute(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  sprContragents: TsprContragents;

implementation

uses MAIN, frm_ContrDebtTypes, MAIN_DM;

{$R *.dfm}

procedure TsprContragents.aDTypesExecute(Sender: TObject);
begin
  if not dsReestr.Active then exit;
  if dsReestrID.IsNull then exit;
  frmContrDebtTypes := TfrmContrDebtTypes.Create(Self);
  frmContrDebtTypes.dsContrTypes.Close;
  frmContrDebtTypes.dsContrTypes.ParamByName('pcontr_id').Value := dsReestrID.AsInteger;
  frmContrDebtTypes.dsContrTypes.Open;
  frmContrDebtTypes.ShowModal;
  frmContrDebtTypes.Free; 
end;

procedure TsprContragents.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  MAINDM.dsContragents.CloseOpen(true);
  inherited;
end;

end.
